package com.woniuxy.dr_mall.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.dr_mall.entity.DrVSku;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * @author 张哲轩
 * @version 1.0.0
 * @ClassName DrVSkuMapper.java
 * @createTime 2021年08月16日 15:59:00
 */
public interface DrVSkuMapper extends BaseMapper<DrVSku> {
    @Select("select * from v_sku")
    @Results({
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "productId",property = "productId"),
            @Result(column = "productId", property = "pictures", many = @Many(
                    fetchType = FetchType.LAZY,
                    select = "com.woniuxy.dr_mall.mapper.DrPictureMapper.getPicturesByProductId"
            ))
    })
    List<DrVSku> getAllSkus();
}
